package com.jerry.shop.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jerry.shop.enums.ProductStatusEnum;
import com.jerry.shop.utils.EnumUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 商品
 */
@Data
public class Product {

    private String id;               //id
    private String name;             //名字
    private BigDecimal price;        //单价
    private Integer stock;           //库存
    private String description;      //描述
    private String icon;             //小图
    private Integer status = ProductStatusEnum.UP.getCode();    //状态, 0正常, 1下架
    private Integer categoryType;    //类目编号

    @JsonIgnore
    public ProductStatusEnum getProductStatusEnum() {
        return EnumUtil.getByCode(status, ProductStatusEnum.class);
    }

}
